Report post

How to comment multiple lines in JavaScript?

To comment multiple lines in JavaScript, use the /* */. Multiple line comments are used to prevent the execution of many lines of code. Javascript multiline comments, also known as block comments, start with a forward slash followed by an asterisk (/*) and end with an asterisk followed by a forward slash (*/).

What are JavaScript comments?

JavaScript comments can be used to explain JavaScript code, and to make it more readable. JavaScript comments can also be used to prevent execution, when testing alternative code. Single line comments start with //. Any text between // and the end of the line will be ignored by JavaScript (will not be executed).

What is a multi-line comment?

Multi-line comments are written using the /* and */ symbols. Anything that is written between the /* and */ symbols in single or multiple lines is as a comment. The following code is a multi-line comment. You can use multi-line comments to prevent a large block of code from being executed by commenting out the code.

Should I use line comments instead of block comments?

When I test, I often need to comment out large chunks of code that already have multiline comments. Just add line comments instead of block comments. Nested block comments are still commented that way. Please look into this programmers.stackexchange.com/questions/201388/… I guess you should use line comment.

Related articles

The World's Leading Crypto Trading Platform

Get my welcome gifts